# demo03_while.py    break  continue  else
# 计算1~100的和
# break:终止当前循环，立刻执行循环外部的代码
# continue:跳过当次循环，立刻执行下一次循环
# else:当循环正常退出的时候(非break),会执行else代码块中的功能
counter = 1  # 计数器
sum100 = 0  # 记录总和
while counter <= 100:
    if counter == 2:
        break
    sum100 += counter  #sum100=sum100 + counter
    counter += 1  # 2
else:
    print("while ok~")
print("sum100:", sum100)  # 5050

num = 1
he = 0
while num <= 100:
    if num == 2:
        num += 1
        continue
    he += num
    num += 1
print("he:", he)  # 5048


# hp = 3
# while hp > 0:
#     print("放技能")
#     hp -= 1
# print("hp:", hp)